﻿using UnityEngine;
using System.Collections;
namespace HotUI{
	public class MyLuaMain : MyLuaBehaviour {
		protected override void LoadLuaAssets ()
		{
			base.LoadLuaAssets ();
				luaEnv.AddLoader((ref string filename) => {
					var testobj = GameTool.ResourcesLua("lua_"+filename);
					var text = testobj as TextAsset;
					if (text!=null)
					{
						var re = System.Text.Encoding.UTF8.GetBytes(text.text);
						text = null;
						return re;
					}
					return null;
				});
			luaScriptPath = "lua_luamain";
			luaScript = GameTool.ResourcesLua(luaScriptPath) as TextAsset;
			InitLua();
			GameObject.DontDestroyOnLoad(gameObject);
		}
	}
}